﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Shop.Web.Models
{
    public class JsMessage
    {
        public JsMessage(string message,int showTime,JsMessageType type=JsMessageType.Success)
        {
            Message = message;
            ShowTime = showTime;
            Types = type;
        }
        /// <summary>
        /// 提示消息
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 显示时间
        /// </summary>
        public int ShowTime { get; set; } = 3;

        public JsMessageType Types { get; set; } = JsMessageType.Success;
        public override string ToString()
        {
            return $"window.messageAlert('{Message}', {ShowTime}, {((int)Types)});";
        }
    }

    public enum JsMessageType
    {
        Success=1,
        Info=2,
        Warning=3,
        Danger=4,
        Secondary=5,
        Primary=6
    }
}
